package elcs.point.model;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Repository;

import elcs.member.model.MemberDao;
import elcs.member.model.MemberVO;
@Repository
public class TradePointServiceImpl implements TradePointService{
	@Resource(name="tradePointDaoImpl")
	private TradePointDao tradePointDao;
	@Resource(name="memberDaoImpl")
	private MemberDao memberDao;
	
	
	@Override
	public void minusPoint(HttpSession session, String content) {
		// TODO Auto-generated method stub
		System.out.println("minusPoint");
		MemberVO mvo=(MemberVO)session.getAttribute("mvo");
		TradePointVO tpVO=new TradePointVO(content,0,1000,mvo.getId());
		tradePointDao.register(tpVO);
		mvo.setPoint(mvo.getPoint()-1000);
		memberDao.updateMemberByPoint(mvo);
	}


	@Override
	public List mypagePointList(String id) {
		// TODO Auto-generated method stub
		return tradePointDao.mypagePointList(id) ;
	}

}
